# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=path.py
pkgbase=mingw-w64-python-${_realname}
pkgname=(
  "${MINGW_PACKAGE_PREFIX}-python3-path"
  "${MINGW_PACKAGE_PREFIX}-python2-path"
)
pkgver=8.2.1
pkgrel=1
pkgdesc="File system based database that uses python pickles (mingw-w64)"
url="https://github.com/jaraco/path.py"
arch=('any')
license=('MIT')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python3-setuptools"
  "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
   "${MINGW_PACKAGE_PREFIX}-python3-colorama"
   "${MINGW_PACKAGE_PREFIX}-python2-colorama"
)
checkdepends=(
  "${MINGW_PACKAGE_PREFIX}-python3-pytest"
  "${MINGW_PACKAGE_PREFIX}-python2-pytest"
  "${MINGW_PACKAGE_PREFIX}-python3-py"
  "${MINGW_PACKAGE_PREFIX}-python2-py"
)
source=("https://pypi.python.org/packages/source/p/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('c9ad2d462a7f8d7f6f6d2b89220bd50425221e399a4b8dfe5fa6725eb26fd708')


prepare() {
  cp -a ${_realname}-${pkgver}{,-py2}
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  python3 setup.py build

  cd ${srcdir}/${_realname}-${pkgver}-py2
  python2 setup.py build
}

#check() {
#    cd ${srcdir}/${_realname}-${pkgver}
#    py.test-3.5
#
#    cd ${srcdir}/${_realname}-${pkgver}-py2
#    py.test-2.7
#}

package_python3-path() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3")

  cd ${srcdir}/${_realname}-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -d ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}
  head -n 21 path.py > ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}

package_python2-path() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2")

  cd ${srcdir}/${_realname}-${pkgver}-py2
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -d ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}
  head -n 21 path.py > ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

package_mingw-w64-i686-python2-path() {
  package_python2-path
}

package_mingw-w64-i686-python3-path() {
  package_python3-path
}

package_mingw-w64-x86_64-python2-path() {
  package_python2-path
}

package_mingw-w64-x86_64-python3-path() {
  package_python3-path
}

# vim:set ts=2 sw=2 et:
